# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test11
# Description:   函数嵌套（闭包）
# Author:       ASUS
# Date:         2019/3/9
#-------------------------------------------------------------------------------


# 函数嵌套
x = 30
def fun5():
    x = 40
    def fun6():
        print(x)
        print("fun6")
    return fun6

fun5()()



def funcA(x):
    index = 0
    print('funcA')
    index += 2
    print('funcA',index)

    def funcB(y=0):
        print('funcB',index)
        print(funcB)
        if y:
            ret = x*y
        else:
            ret = x*index
        return ret
    return funcB

funcC11 = funcA(3)
print('funcC',type(funcC11))

result1 = funcC11()
print(result1)

result1 = funcC11(5)
print(result1)






